var app = getApp();

function get_all_my_list(callback) {
  wx.showLoading();
  console.log('now get all my list event ...');
  wx.request({
    url: app.globalData.default_url,
    data: {
      action: 'api.v1.event.get_all_my_list',
      owner: wx.getStorageSync("yuyue_session"),
    },
    success: function (res) {
      callback(res);
    },
    complete: function () {
      wx.hideLoading();
    }
  });
}

function edit(id, title, content, type, owner, yuyue_session, callback) {
  wx.showLoading();
  wx.request({
    url: app.globalData.default_url,
    data: {
      action: 'api.v1.calendar.edit',
      id: id,
      title: title,
      content: content,
      type: type,
      owner: owner,
      yuyue_session: yuyue_session,
    },
    success: function (res) {
      console.log(res);
      callback(res);
    },
    complete: function () {
      wx.hideLoading();
    }
  });
}

module.exports = {
  get_all_my_list: get_all_my_list,
  edit: edit,
}